package acm;

import java.util.Scanner;

public class a16 {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String n = in .nextLine();
        long m=Long.parseLong(n,16);
        System.out.print(m);
    }
}
